<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');


class Logout extends CI_Controller {

	function __construct()
	{
		parent::__construct();
	}

	public function index()
	{
		$this->load->helper('url');
		$this->load->model('event_log_m');
		$this->load->helper('date');
		echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
		$event=array(
					'username'=>$this->session->userdata('username'),
					'event'=>'logout',
					'time'=>unix_to_human(now(), TRUE,'PRC')				
		);
		$this->event_log_m->user_insert($event);
		$this->session->unset_userdata('username');
		$this->session->unset_userdata('password');
		//var_dump($this->session->all_userdata());
		echo("
   				<Script>
   				window.alert(\"注销成功！\")
   				</Script>");
		redirect('index','refresh');
	}

}
?>